<template>
  <div class="app-container">
    <DataTable
      ref="customTable"
      :request="orgPage"
      :search-form="searchForm"
    >
      <template slot="search">
        <el-form-item prop="orgName">
          <el-input v-model="searchForm.orgName" type="text" placeholder="机构名称" />
        </el-form-item>
        <el-form-item
          prop="orgCode"
        >
          <el-input v-model="searchForm.orgCode" type="text" placeholder="机构编码" />
        </el-form-item>
      </template>
      <template slot="function">
        <el-button v-permission="['function:admin:org:add']" type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
      </template>
      <template slot="tableColumns">
        <el-table-column prop="id" label="ID" :show-overflow-tooltip="true" />
        <el-table-column prop="orgName" label="名称" />
        <el-table-column prop="orgCode" label="权限编码" />
        <el-table-column prop="action" label="操作">
          <template slot-scope="scope">
            <el-button-group>
              <el-button
                type="primary"
                icon="el-icon-share"
                circle
                @click.native.prevent="orgTree(scope.$index, scope.row)"
              />
              <el-button
                type="danger"
                icon="el-icon-delete"
                circle
                @click.native.prevent="remove(scope.$index, scope.row)"
              />
            </el-button-group>
          </template>
        </el-table-column>
      </template>
    </DataTable>
  </div>
</template>
